import pageination from '../../components/pageination/pageination.vue'
export default {
	//数据
	data() {
		return {
			total: 0, //总条数
			page: 1, //当前页
			size: 4, //每页显示条数
			workDynamicList: [], //工作动态列表信息
			fatherIndex:0, //一级菜单下标
		}
	},
	components: {
		pageination
	},
	created() { //调用方法
		//初始化新闻动态
		this.searchTodo();
	},
	mounted() {

	},
	updated:function(){
		if(this.getParamValue("fatherIndex")){
			this.fatherIndex=this.getParamValue("fatherIndex");
		}
	},
	methods: { //写函数方法
		//页码切换执行方法
		pageFn: function(val, pid) {
			this.page = parseInt(val);
			//此处调列表数据接口
			this.searchTodo(pid); //查询新闻
		},
		/**返回子组件用户选择的一页显示条数**/
		obtainChild: function(data) {
			this.row = data;
		},
		//搜索数据列表
		searchTodo: function() {
			let that = this;
			//初始化新闻动态
			that.$post(
					that.urls.getWorkDynamicPageInfo, {
						"pageNum": that.page,
						"pageSize": that.size
					}
				)
				.then(function(res) {
					if(res.success) {
						that.workDynamicList = res.pageInfo.list;
						that.total=res.pageInfo.total;
					}
				})
		},
		//打开动态详情
		NewsDetails: function(uuid) {
			if(uuid != null && uuid != "") {
				this.set("WorkingDynamicDetailsid", uuid);
				this.$router.push({
					path: "/NewsDetails?fatherIndex="+this.getParamValue("fatherIndex"),
				})
			}
		},
	}
}